package com.example.springevent.event.listener;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.ApplicationListener;
import org.springframework.context.PayloadApplicationEvent;
import org.springframework.stereotype.Component;

import com.example.springevent.ivd.domain.InvoiceKey;
import com.example.springevent.ivd.domain.InvoiceVerifyDetail;

//@Component
public class IvdRemovedEventInvoiceListener
		implements ApplicationListener<PayloadApplicationEvent<InvoiceVerifyDetail>> {

	private static final Logger log = LoggerFactory.getLogger(IvdRemovedEventInvoiceListener.class);

	@Override
	public void onApplicationEvent(PayloadApplicationEvent<InvoiceVerifyDetail> event) {
		log.info("未注册为bean，不是有效的事件监听器");
		InvoiceVerifyDetail ivd = event.getPayload();
		System.out.println(String.format("发票[%s]减少核销金额[%s]", new InvoiceKey(ivd.getInvoiceCode(), ivd.getInvoiceNo()),
				ivd.getVerifyAmt()));
	}

}
